package com.example.timecodecalc;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Point;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.view.View;

public class Shadow extends View.DragShadowBuilder {
	
	private static Drawable shadow;

	
	public void onProvideShadowMetrics (Point size, Point touch)
{
    // Defines local variables
   final int width, height;

    // Sets the width of the shadow to half the width of the original View
    width = getView().getWidth() ;

    // Sets the height of the shadow to half the height of the original View
    height = getView().getHeight();

    // The drag shadow is a ColorDrawable. This sets its dimensions to be the same as the
    // Canvas that the system will provide. As a result, the drag shadow will fill the
    // Canvas.
    shadow.setBounds(0, 0, width, height);

    // Sets the size parameter's width and height values. These get back to the system
    // through the size parameter.
    size.set(width, height);

    // Sets the touch point's position to be in the middle of the drag shadow
    touch.set(width , height );
}

	public Shadow(View arg0) {
		super(arg0);
		shadow = new ColorDrawable(Color.LTGRAY);
		
		// TODO Auto-generated constructor stub
	}
	public void onDrawShadow(Canvas canvas) {

        // Draws the ColorDrawable in the Canvas passed in from the system.
        shadow.draw(canvas);
    }

}
